<include file="Public/min-header"/>
<style>
    ul.group-list {
        width: 96%;min-width: 1000px; margin: auto 5px;list-style: disc outside none;
    }
    ul.group-list li {
        white-space: nowrap;float: left;
        width: 150px; height: 25px;
        padding: 3px 5px;list-style-type: none;
        list-style-position: outside;border: 0px;margin: 0px;
    }
</style>
<script type="text/javascript">
    window.UEDITOR_Admin_URL = "__ROOT__/Public/plugins/Ueditor/";
    var URL_upload = "{$URL_upload}";
    var URL_fileUp = "{$URL_fileUp}";
    var URL_scrawlUp = "{$URL_scrawlUp}";
    var URL_getRemoteImage = "{$URL_getRemoteImage}";
    var URL_imageManager = "{$URL_imageManager}";
    var URL_imageUp = "{$URL_imageUp}";
    var URL_getMovie = "{$URL_getMovie}";
    var URL_home = "{$URL_home}";</script>
<script type="text/javascript" charset="utf-8" src="__ROOT__/Public/plugins/Ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="__ROOT__/Public/plugins/Ueditor/ueditor.all.min.js"></script>
<script type="text/javascript" charset="utf-8" src="__ROOT__/Public/plugins/Ueditor/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript">
    var editor;
    $(function () {
        //具体参数配置在  editor_config.js  中
        var options = {
            zIndex: 999,
            initialFrameWidth: "95%", //初化宽度
            initialFrameHeight: 400, //初化高度
            focus: false, //初始化时，是否让编辑器获得焦点true或false
            maximumWords: 99999,
            removeFormatAttributes: 'class,style,lang,width,height,align,hspace,valign', //允许的最大字符数 'fullscreen',
            pasteplain: false, //是否默认为纯文本粘贴。false为不使用纯文本粘贴，true为使用纯文本粘贴
            autoHeightEnabled: true,
            /*   autotypeset: {
             mergeEmptyline: true, //合并空行
             removeClass: true, //去掉冗余的class
             removeEmptyline: false, //去掉空行
             textAlign: "left", //段落的排版方式，可以是 left,right,center,justify 去掉这个属性表示不执行排版
             imageBlockLine: 'center', //图片的浮动方式，独占一行剧中,左右浮动，默认: center,left,right,none 去掉这个属性表示不执行排版
             pasteFilter: false, //根据规则过滤没事粘贴进来的内容
             clearFontSize: false, //去掉所有的内嵌字号，使用编辑器默认的字号
             clearFontFamily: false, //去掉所有的内嵌字体，使用编辑器默认的字体
             removeEmptyNode: false, // 去掉空节点
             //可以去掉的标签
             removeTagNames: {
             "font": 1
             },
             indent: false, // 行首缩进
             indentValue: '0em' //行首缩进的大小
             },*/
            toolbars: [
                ['fullscreen', 'source', '|', 'undo', 'redo',
                    '|', 'bold', 'italic', 'underline', 'fontborder',
                    'strikethrough', 'superscript', 'subscript',
                    'removeformat', 'formatmatch', 'autotypeset',
                    'blockquote', 'pasteplain', '|', 'forecolor',
                    'backcolor', 'insertorderedlist',
                    'insertunorderedlist', 'selectall', 'cleardoc', '|',
                    'rowspacingtop', 'rowspacingbottom', 'lineheight', '|',
                    'customstyle', 'paragraph', 'fontfamily', 'fontsize',
                    '|', 'directionalityltr', 'directionalityrtl',
                    'indent', '|', 'justifyleft', 'justifycenter',
                    'justifyright', 'justifyjustify', '|', 'touppercase',
                    'tolowercase', '|', 'link', 'unlink', 'anchor', '|',
                    'imagenone', 'imageleft', 'imageright', 'imagecenter',
                    '|', 'insertimage', 'emotion', 'insertvideo',
                    'attachment', 'map', 'gmap', 'insertframe',
                    'insertcode', 'webapp', 'pagebreak', 'template',
                    'background', '|', 'horizontal', 'date', 'time',
                    'spechars', 'wordimage', '|',
                    'inserttable', 'deletetable',
                    'insertparagraphbeforetable', 'insertrow', 'deleterow',
                    'insertcol', 'deletecol', 'mergecells', 'mergeright',
                    'mergedown', 'splittocells', 'splittorows',
                    'splittocols', '|', 'print', 'preview', 'searchreplace'
                ]
            ]
        };
        editor = new UE.ui.Editor(options);
        editor.render("news_content"); //  指定 textarea 的  id 为 news_content
    });</script>
<div class="wrapper">
    <include file="Public/breadcrumb" />
    <section class="content">
        <div class="container-fluid">
            <div class="pull-right">
                <a href="javascript:history.go(-1)" data-toggle="tooltip" title="" class="btn btn-default" data-original-title="返回"><i class="fa fa-reply"></i></a>
            </div>
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title"><i class="fa fa-list"></i>邀请码详情</h3>
                </div>
                <div class="panel-body">
                    <ul class="nav nav-tabs">
                        <li class="active"><a href="#tab_tongyong" data-toggle="tab">通用信息</a></li>
                    </ul>
                    <form method="post" id="addEditnewsForm" action="{:U('Admin/news/addEditnewsForm')}" enctype="multipart/form-data">
                        <div class="tab-content">
                            <div class="tab-pane active" id="tab_tongyong">
                                <table class="table table-bordered">
                                    <tbody>
                                        <tr>
                                            <td class = "text-right">邀请码名称:</td>
                                            <td>
                                                <input type="text" value="{$newsInfo.title}" name="title" class="form-control" style="width:550px;" />
                                                <span id="err_news_name" style="color:#F00; display:none;"></span>
                                            </td>
                                        </tr>
										<tr>
                                            <td class = "text-right">类型:</td>
                                            <td>
                                                <select name="cat_id" class="form-control">
													<option value="1">出品者</option>
													<option value="2">评论者</option>
												</select>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class = "text-right">可使用次数:</td>
                                            <td>
                                                <input type="text" value="{$newsInfo.number}" name="number" style="width:550px;" class="form-control" />
                                                <span id="err_shop_price" style="color:#F00; display:none;"></span>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                            
                        </div>
                        <div class="pull-right">
                            <input type="hidden" name="act" value="{$act}">
                            <input type="hidden" name="id" value="{$newsInfo.id}">
                            <input type="submit" class="btn btn-primary" value="保存">
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </section>
</div>
</body>
<script>
    function add_spec(){
        var html='<tr>';
        html+='<td width="80" style="padding-top:30px;">规格名称:</td>';
        html+='<td width="150" style="padding-top:30px;">';
        html+='        <input name="spec_name[]" type="text" class="form-control"><input type="hidden" name="spec_id[]" value="0">';
        html+='</td>';
        html+='<td width="120" style="padding-left:40px;padding-top:30px;">规格价格:</td>';
        html+='<td width="150" style="padding-top:30px;">';
        html+='    <input name="spec_price[]" type="text" class="form-control">';
        html+='</td>';
        html+='<td width="120" style="padding-left:40px;padding-top:30px;">规格原价:</td>';
        html+='<td width="150" style="padding-top:30px;">';
        html+='    <input name="spec_mk_price[]" type="text" class="form-control">';
        html+='</td>';
        html+='</tr>';
        $('#spec_list').append(html);
    }
    // 上传商品相册回调函数
    function call_back2(paths) {
        var last_div = $(".news_xc:last").prop("outerHTML");
        for (i = 0; i < paths.length; i++) {
            $(".news_xc:eq(0)").before(last_div); // 插入一个 新图片
            $(".news_xc:eq(0)").find('a:eq(0)').attr('href', paths[i]).attr('onclick', '').attr('target', "_blank"); // 修改他的链接地址
            $(".news_xc:eq(0)").find('img').attr('src', paths[i]); // 修改他的图片路径
            $(".news_xc:eq(0)").find('a:eq(1)').attr('onclick', "ClearPicArr2(this,'" + paths[i] + "')").text('删除');
            $(".news_xc:eq(0)").find('input').val(paths[i]); // 设置隐藏域 要提交的值
        }
    }
    function ClearPicArr2(obj, path) {
        $.ajax({
            type: 'GET',
            url: "{:U('Admin/Uploadify/delupload')}",
            data: {
                action: "del",
                filename: path
            },
            success: function () {
                $(obj).parent().remove(); // 删除完服务器的, 再删除 html上的图片
            }
        });
        // 删除数据库记录
        $.ajax({
            type: 'GET',
            url: "{:U('Admin/news/delnewsImg')}",
            data: {
                filename: path
            },
            success: function () {
                //
            }
        });
    }
</script>
</html>
